<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:fragment="base-head">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title th:if="${siteInfo==null}">后台管理系统</title>
    <th:block th:if="${siteInfo != null}">
        <title th:utext="${siteInfo.title+(currentMenu!=null?(' - '+currentMenu.name):'')}">AdminLTE
            2 | Starter</title>
        <meta th:content="${siteInfo.description}" name="description">
        <meta th:content="${siteInfo.keywords}" name="keywords">
    </th:block>
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback" rel="stylesheet">
    <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
    <link rel="stylesheet" href="/plugins/fontawesome-free/css/all.min.css">
    <link rel="stylesheet" href="/adminlte/css/adminlte.min.css">
    <link rel="stylesheet" href="/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
</th:block>
</head>
<!-- layout-footer-fixed -->
<!-- hold-transition layout-fixed accent-primary -->

<body class="sidebar-mini layout-footer-fixed">
<!-- Navbar -->

<nav class="main-header navbar navbar-expand navbar-dark navbar-light"
     th:fragment="base-navbar">
    <ul class="navbar-nav">
        <li class="nav-item">
            <a class="nav-link" data-widget="pushmenu" href="#" role="button">
                <i class="fas fa-bars"></i>
            </a>
        </li>
		<li class="nav-item d-sm-inline-block">
			<a href="/" class="nav-link" target="_blank">首页</a>
		</li>
    </ul>
    <ul class="navbar-nav ml-auto">
        <li class="nav-item d-sm-inline-block" th:if=${permissionUtils.checkPost('/admins/shutdown')}>
            <div class="nav-link" 
               data-dialog="confirm"
               data-url="/admins/shutdown"
               data-method="post"
               data-dialog-t-msg="请确定是否真的要关闭网站？"> <i class="fas fa-power-off"></i>
                关闭网站
            </div>
        </li>
    </ul>
</nav>
<!-- /.navbar -->
<!-- Main Sidebar Container -->
<aside class="main-sidebar sidebar-dark-primary elevation-4"
       th:fragment="base-main-sidebar">
    <a href="/admin/index" class="brand-link"> <img
            src="/adminlte/img/AdminLTELogo.png" alt="AdminLTE Logo"
            class="brand-image img-circle elevation-3" style="opacity: .8">
        <span class="brand-text font-weight-light">KAIBES</span>
    </a>
    <div class="sidebar">
        <!-- Sidebar -->
        <div class="user-panel mt-3 pb-3 mb-3 d-flex" th:if="${user!=null}">
            <div class="image" style="padding-top: 0.2rem; padding-left: 0.2rem">
                <img data-tag="userImage"
                     th:src="${StringUtils.isNotEmpty(user.image)?user.image:'/adminlte/img/user3-128x128.jpg'}"
                     class="img-circle elevation-2"
                     style="width: 50px; height: 50px; object-fit: cover;"
                     alt="User Image" data-href="/admin/user/self">
            </div>
            <div class="info">
                <a class="d-block" style="cursor: pointer;"
                   href="/admin/user/self" th:utext="${user.nickname}">用户昵称</a>
                <a class="float-left" href="#" th:if="${user.id!=null}"> <i
                        class="fas fa-circle text-success"></i> 在线
                </a> <a class="float-left" href="#" th:if="${user.id==null}"> <i
                    class="fas fa-circle text-failure"></i> 离线
            </a>
                <a style="margin-left: 2em" 
                   data-dialog-t-msg="是否确认退出登录？"
                   data-dialog="confirm"
                   data-url="/tokens/logout"
                   data-method="delete"
                   th:if="${user.id!=null}"> <i class="fas fa-sign-out-alt text-danger"></i> 注销
                </a>
            </div>
        </div>
        
        <!-- SidebarSearch Form -->
      <div class="form-inline">
        <div class="input-group" data-widget="sidebar-search">
          <input class="form-control form-control-sidebar" type="search" placeholder="Search" aria-label="Search">
          <div class="input-group-append">
            <button class="btn btn-sidebar">
              <i class="fas fa-search fa-fw"></i>
            </button>
          </div>
        </div>
      </div>
      
      <!-- Sidebar Menu -->
      <!-- nav-child-indent; nav-flat  -->
        <nav class="mt-2" style="margin-bottom: 10rem">
            <ul class="nav nav-pills nav-sidebar flex-column nav-child-indent"
                data-widget="treeview" role="menu" data-accordion="false">
                <th:block th:each="menu:${adminMenuList}" th:unless="${menu.menuList.isEmpty()}">
                    <li class="nav-header" th:utext="${menu.name}"></li>
                    <th:block th:each="parent:${menu.menuList}"
                              th:with="flag=${StringUtils.isEmpty(parent.href)}">
                              
                        <li class="nav-item has-treeview"
                            th:if="${flag && !parent.menuList.isEmpty()}"
                            th:with="isOpen=${AdminMenuUtils.hasChild(parent, currentMenu)}"
                            th:classappend="${isOpen?'menu-open':''}">
                            <a href="#"
                               class="nav-link"
                               th:classappend="${isOpen?'active':''}"> <i
                                    th:class="${'nav-icon '+parent.icon}"></i>
                                <p>
                                    <th:block th:utext="${parent.name}">菜单标题</th:block>
                                    <i class="right fas fa-angle-left"></i>
                                </p>
                            </a>
                            <ul class="nav nav-treeview">
                                <li class="nav-item" th:each="menu:${parent.menuList}"><a
                                        class="nav-link" th:href="${menu.href}"
                                        th:classappend="${AdminMenuUtils.equals(currentMenu, menu)?'active':''}">
                                    <i th:class="${'nav-icon '+menu.icon}"></i>
                                    <p th:utext="${menu.name}">网站设置</p>
                                </a></li>
                            </ul>
                        </li>
                        <li class="nav-item" th:unless="${flag}"><a
                                th:href="${parent.href}" class="nav-link"
                                th:classappend="${AdminMenuUtils.equals(currentMenu, parent)?'active':''}">
                            <i th:class="${'nav-icon '+parent.icon}"></i>
                            <p th:utext="${parent.name}"></p>
                        </a></li>
                    </th:block>
                </th:block>
            </ul>
        </nav>
    </div>
</aside>
  
<!-- Content Wrapper. Contains page content -->
<div class="content-header" th:if="${currentMenu!=null}"
     th:fragment="base-content-header">
    <div class="container-fluid">
        <div class="row mb-2">
            <div class="col-sm-6">
                <h1 class="m-0 text-dark" th:utext="${currentMenu.name}"></h1>
            </div>
            <div class="col-sm-6">
                <ol class="breadcrumb float-sm-right">
                    <li class="breadcrumb-item" th:if="${currentMenu.parent != null}">
                        <a href="#">
                            <th:block th:utext="${currentMenu.parent.name}"></th:block>
                        </a>
					</li>
                    <li class="breadcrumb-item active" th:utext="${currentMenu.name}">菜单管理</li>
                </ol>
            </div>
        </div>
    </div>
</div>

<th:block th:fragment="base-footer">
<footer class="main-footer">
    <strong>Copyright &copy; 2014-2021 <a
            href="http://adminlte.io">AdminLTE.io</a>.
    </strong> All rights reserved.
    <div class="float-right d-none d-sm-inline-block">
        <b>Version</b> 3.1.0-rc
    </div>
</footer>
<script src="/plugins/jquery/jquery.min.js"></script>
<script src="/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<script src="/adminlte/js/adminlte.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jsencrypt/3.0.0-rc.1/jsencrypt.min.js"></script>
<script src="/kaibes/js/base.js"></script>
<script src="/kaibes/js/toast.js"></script>
<script src="/kaibes/js/dialog.js"></script>
<script src="/kaibes/js/network.js"></script>
<script>
document
      .querySelector("body")
      .setAttribute("class", "sidebar-mini layout-footer-fixed");
</script>
</th:block>

<th:block th:fragment="pageNav(pageData, unit)"
          th:if="${pageData.totalCount>0}">
    <div class="row">
        <div class="col-sm-12 col-md-5">
            <div class="dataTables_info"
                 th:with="start=${(pageData.pageIndex-1)*pageData.pageSize+1},end=${pageData.pageIndex*pageData.pageSize}"
                 th:utext="${StringUtils.format('显示第 %d 至 %d %s，共 %d %s',start,end<pageData.totalCount?end:pageData.totalCount, unit, pageData.totalCount, unit)}">
                显示第 1 至 25 项结果，共 27 项
            </div>
        </div>
        <div class="col-sm-12 col-md-7">
            <div class=" paging_simple_numbers" id="menu-table_paginate">
                <ul class="pagination pagination-sm float-right my-0 py-0" th:with="urlPage=${WebPageUtils.getPageUri(#request)}">
                    <li th:class="${'page-item previous '+(pageData.hasLast()?'':'disabled')}">
                        <a class="page-link"
                           th:href="${pageData.hasLast()?(urlPage+(pageData.pageIndex-1)):'#'}">上页</a>
                    </li>
                    <li th:each="page:${PageUtils.getPages(pageData)}"
                        th:class="${'page-item '+(pageData.pageIndex==page?'active':'')}"
                        th:if="${page!=-99}" th:with="flag=${page!=0}"><a
                            class="page-link" th:href="${flag?(urlPage+page):'#'}"
                            th:utext="${flag?page:'…'}"></a></li>
                    <li th:class="${'page-item next '+(pageData.hasNext()?'':'disabled')}">
                        <a class="page-link"
                           th:href="${pageData.hasNext()?(urlPage+(pageData.pageIndex+1)):'#'}">下页</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</th:block>

<aside class="control-sidebar control-sidebar-dark"
       th:fragment="base-control-sidebar"></aside>

<th:block th:fragment="base-js">
<script src="/plugins/jquery/jquery.min.js"></script>
<script src="/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<script src="/adminlte/js/adminlte.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jsencrypt/3.0.0-rc.1/jsencrypt.min.js"></script>
</th:block>

</body>

</html>